<template>
  <el-container>
    <el-header height="81px">
        <headTop :show-balance='true'>
        </headTop>
    </el-header>
    <el-container>
      <el-aside width="180px">
        <el-menu :default-active="$route.path" class="menu" router :default-openeds="openeds"
          text-color="#555555"
          active-text-color="#F4450C">
						<!--<el-menu-item index="manage"><i class="el-icon-menu"></i>首页</el-menu-item>-->
						<el-submenu index="2">
							<template slot="title"><span class="menu_title">礼品网</span></template>

							<el-menu-item index="giftList">礼品代发</el-menu-item>
							<el-menu-item index="deliveryRecords">发货记录</el-menu-item>
							<el-menu-item index="address">发货地址</el-menu-item>
						</el-submenu>
						<el-submenu index="3">
							<template slot="title"><span class="menu_title">用户中心</span></template>
							<!-- <el-menu-item index="myInfo">我的信息</el-menu-item> -->
							<el-menu-item index="points">金币充值</el-menu-item>
							<el-menu-item index="consume">消费记录</el-menu-item>
						</el-submenu>
						<el-submenu v-if="role !== 'USER'" index="4">
							<template slot="title"><span class="menu_title">运营中心</span></template>
							<el-menu-item :index="defaultAdminActive">我的运营</el-menu-item>
							
						</el-submenu>
	          <el-submenu index="5">
							<template slot="title"><span class="menu_title">帮助中心</span></template>
							<el-menu-item index="teach">礼品使用教程</el-menu-item>
							<el-menu-item index="notice">公告中心</el-menu-item>
						</el-submenu>
					</el-menu>
      </el-aside>
      <el-main>
        <!-- <div class="router-container"> -->
          <router-view></router-view>
        <!-- </div> -->
        
      </el-main>
      <div id='qr'>
					<p>
						工作时间 9:00 - 18:00
					</p>
					<p>
						<img :src='wx_service'>
					</p>
					<div style='margin-top: 20px;'>
            <a target="_blank" :href="qq_href"><img border="0" :src="qq_image" alt="联系客服" title="联系客服"/></a> 
            <!-- <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=3013053440&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:3013053440:51" alt="联系客服" title="联系客服"/></a>  -->
          </div>
				</div>
    </el-container>
  </el-container>
  <!-- <el-container>
		<el-header height='80'>
  	</el-header>
		<div class="manage_page fillcontain">
			<el-row style="height: 100%;">
					<el-col :span="4"  style="min-height: 100%;">
					

					
          
				</el-col>
				<el-col :span="20" style="height: 100%;overflow: auto;" classMain>
				</el-col>
			</el-row>
			</div>
  </el-container> -->
</template>

<script scoped>
    import headTop from '@/components/headTop'
    // import {level} from '@/utils/cookie'
    // import {getUserAccount, getUserInfo} from '@/api/myinfo'
    import {wxQRImage} from '@/config/env'
    import { mapActions, mapState, mapGetters } from 'vuex'
    import {USER, PRINTER} from '@/utils/cookie'

    export default {

      components: {
        headTop
      },
      data () {
        return {
          openeds: ['1', '2', '3', '4', '5'],
          subsite: location.host === 'www.yingxiaolipin.com',
          // userName: '',
          // levelDesc: '',
          balance: 0,
          wxQRImage: wxQRImage
        }
      },
      mounted () {
        this.initData()
      },
      methods: {
        ...mapActions(['getAllConfig', 'getUserAccount', 'getUserInfo']),
        async initData () {
          this.getUserAccount()
          this.getUserInfo()
          this.getAllConfig()
        },
      },
      computed: {
        ...mapState(['role']),
        ...mapGetters(['namespace']),
        defaultActive: function () {
          return this.$route.path.replace('/', '')
        },
        defaultAdminActive: function () {
          if (this.role === PRINTER) {
            return '/admin/orderQuery'
          } else {
            return '/admin/statistic'
          }
        },
        wx_service: function() {
          return `./${this.namespace}_wx.jpg`
        },
        qq_href: function() {
          return `http://wpa.qq.com/msgrd?v=3&uin=${this.$store.getters.getConfigByKey('qq_account')}&site=qq&menu=yes`
        },
        qq_image: function() {
          return `http://wpa.qq.com/pa?p=2:${this.$store.getters.getConfigByKey('qq_account')}:51`
        }
        // level: function () {
        //   return level()
        // }
      }
    }
</script>


<style lang="less" scoped>
	@import '../../style/mixin';

  .el-header, .el-footer {
    // background-color: #B3C0D1;
    // color: #333;
    // text-align: center;
    line-height: 80px;
  }
  
  .el-aside {
    // background-color: #D3DCE6;
    // color: #333;
    // text-align: center;
    overflow: hidden;
    line-height: 200px;
  }
  
  .el-main {
    // background-color: #E9EEF3;
    // color: #333;
    // text-align: center;
    // padding: 0 340px 0 160px;
    
    line-height: 20px;
    padding: 0;
  }
  
  .router-container {
    margin: 0 auto;
    width: 1000px;
  }

  body > .el-container {
    margin-bottom: 40px;
  }
 
  // .menu {
  //   width: 181px;
  // }

  .menu_title {
    color: #222;
    font-size: 16px;
    font-weight: bold;
  }

  .menu {
    height: 100%;
    .el-menu-item {
      padding-left: 20px !important;
    }
  }
  
	#qr {
		background: #ffffff 0;
		margin: 20px 0;
		font-size: 14px;
    text-align: center;
    
    right: 50px;
    position: fixed;
    bottom: 0;//这里换成top:0;就悬浮在头部
    width: 150px;
    z-index: 100;
	}

</style>
